package com.kangyi.admin.mapper;

import com.github.pagehelper.Page;
import com.kangyi.admin.annotation.AutoFill;
import com.kangyi.dto.UserPageQueryDTO;
import com.kangyi.entity.User;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.UserPageQueryVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface UserMapper {
    @Select("select * from user where id = #{userId};")
    User getById(Integer userId);


    Page<UserPageQueryVO> pageQuery(UserPageQueryDTO userPageQueryDTO);

    @Update("update user set status = #{status}, update_user = #{updateUser}, update_time = #{updateTime} where id = #{id};")
    @AutoFill(value = OperationType.UPDATE)
    void bulkOperation(User build);

    @Delete("delete from user where id = #{id};")
    void deleteById(Integer id);
}
